package Demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-03-03
 * Time: 15:37
 */
class Shape {
    public void draw() {
        System.out.println("画图形");
    }
}

class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("画一个矩形");
    }
}

class Circle extends Shape {
    @Override
    public void draw() {
        System.out.println("画一个圆圈");
    }
}

class Triangle extends Shape {
    @Override
    public void draw() {
        System.out.println("画一个三角形");
    }
}

public class Test {
    public static void drawMap(Shape shape) {
        shape.draw();
    }

    public static void main(String[] args) {
        drawMap(new Circle());
        drawMap(new Triangle());
        drawMap(new Rect());
    }
}
